package team.knowers.agency.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import team.knowers.agency.common.convention.result.Result;
import team.knowers.agency.common.convention.result.Results;
import team.knowers.agency.dao.entity.TravelDO;
import team.knowers.agency.dto.req.TravelLoginReqDTO;
import team.knowers.agency.dto.req.TravelRegisterReqDTO;
import team.knowers.agency.service.TravelService;

@RestController
@RequiredArgsConstructor
public class TravelController {
    private final TravelService travelService;
    /**
     * 旅行社注册账号
     * @param req
     */
    @PostMapping("/api/agency/travel/register")
    public Result<Void>register(@RequestBody TravelRegisterReqDTO req)
    {
        travelService.register(req);
        return Results.success();
    }
    /**
     * 旅行社登录账号
     */
    @PostMapping("/api/agency/travel/login")
    public Result<TravelDO> login(@RequestBody TravelLoginReqDTO req)
    {
        return Results.success(travelService.login(req));
    }
}
